package cn.iocoder.yudao.module.dr.dal.mysql.publish;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.dr.controller.admin.publish.vo.PublishPageReqVO;
import cn.iocoder.yudao.module.dr.dal.dataobject.publish.PublishDO;
import org.apache.ibatis.annotations.Mapper;

/**
 *  出版申请 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface PublishMapper extends BaseMapperX<PublishDO> {

    default PageResult<PublishDO> selectPage(PublishPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PublishDO>()
                .likeIfPresent(PublishDO::getBookName, reqVO.getBookName())
                .eqIfPresent(PublishDO::getEditor, reqVO.getEditor())
                .betweenIfPresent(PublishDO::getPublishTime, reqVO.getPublishTime())
                .eqIfPresent(PublishDO::getPublishingHouse, reqVO.getPublishingHouse())
                .eqIfPresent(PublishDO::getFunds, reqVO.getFunds())
                .eqIfPresent(PublishDO::getSourceDunding, reqVO.getSourceDunding())
                .eqIfPresent(PublishDO::getChargeMan, reqVO.getChargeMan())
                .eqIfPresent(PublishDO::getChargeManDept, reqVO.getChargeManDept())
                .eqIfPresent(PublishDO::getPublishNum, reqVO.getPublishNum())
                .eqIfPresent(PublishDO::getAttachFile, reqVO.getAttachFile())
                .betweenIfPresent(PublishDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PublishDO::getId));
    }

}